package com.wanxi.education.mapper;

import com.wanxi.education.model.pojo.Agency;
import com.wanxi.education.model.vo.agency.AgencyInfoVo;
import com.wanxi.education.model.vo.agency.AgencyVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: WangRui
 * @Description:
 * @Date: Created in 2021/9/24 0024
 * @Version: 1.0
 */
public interface AgencyMapper {

    @Insert("insert into agency (name,address,create_time,update_time)" +
            "value (#{name},#{address},NOW(),NOW())")
    @Options(useGeneratedKeys=true, keyProperty="id" ,keyColumn = "id")
    void add(Agency agency);
    @Select("select * from agency where id = #{id} and delete_status=0")
    Agency findById(@Param("id") Long id);
    @Update("update agency set name =#{name},address =#{address},update_time = NOW() where id =#{id} and delete_status=0")
    void updateById(Agency agency);
    @Delete("update agency set update_time = NOW() ,delete_status = #{deleteStatus} where id = #{id}")
    void deleteById(Agency agency);

    List<AgencyVo> findAll(Agency agency);

    List<AgencyInfoVo> findInfoAll();

    List<AgencyInfoVo> findInfoAllNotBinding();
}
